﻿<link href="~/lib/layui/css/layui.css" rel="stylesheet" />
<script src="~/lib/layui/layui.js"></script>
<script src="~/lib/jquery/dist/jquery.js"></script>
<!DOCTYPE html>
<html>
<body>
    @* 导入装配工单 *@

    <button id="test1">上传文件</button>
</body>
</html>
<!-- 请勿在项目正式环境中引用该 layui.js 地址 -->
<script src="//unpkg.com/layui@2.9.20/dist/layui.js"></script>


<script>
    //导入excel表
    layui.use(['upload', 'layer'], function () {
        var $ = layui.jqery,
            upload = layui.upload;
            layer = layui.layer;
        //上传文件
        upload.render({
            elem: '#test1' //绑定元素
            , url: '@ViewBag.Durian' + '/api/Assembly/Handle5' //上传接口
            , accept: 'file' //普通文件
            , done: function (res) {
                //上传完毕回调
                console.log(res)
                //导入成功后提示
                alert(res.messege)
                //导入成功后关闭当前弹框
                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                parent.layer.close(index); //再执行关闭
                //刷新父页面
                parent.location.reload();         
            }
        })
    })
</script>